<template>

  <div id="app">
      <router-view v-if="siteData&&siteData.site.status==='O'" />
      <div v-if="siteData&&siteData.site.status==='C'" class="maintenance">{{siteData.site.maintenance}}</div>
  </div>
</template>

<script>
import indexApi from '@/api/index/nav'
export default {
  name: 'app',
  data(){
    return {
      siteData:null
    }
  },
  created(){
    this.getSiteData();
  },
  methods:{
    getSiteData(){
        indexApi.getSite().then(response=>{
            if(this.$store.state.siteInfo.siteInfoList.length==0){
                this.$store.dispatch("setSiteInfo", response).then(()=>{
                  this.siteData = this.$store.state.siteInfo.siteInfoList;
                })
            }
        })
    }
  }
}
</script>
<style scoped>
  .maintenance{
    margin-top:200px;
    text-align:center;
  }
</style>